<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"> 
<head>
	
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="js/jquery/jquery.js"></script>
<style>
	img.img
	{
		cursor:pointer;
		padding:4px;
	}
	img.checked_img
	{
		background-color:#26F;
	}
	.float_item
	{
		width:140px;
		height:160px;
		margin:5px;
		float:left;
	}
</style>
<!-- INCLUDE meta.html -->
<script src="js/jquery/jquery2.js" ></script>
<script src="js/jquery/ui.datepicker.js" ></script>
<script src="js/jquery/ui.datepicker-zh-CN.js"></script>
<link rel="stylesheet" href="js/jquery/ui.datepicker.css" media="screen" />
</head>
<body>
<div class='maindiv'>

<div class="headerdiv">
	<!-- INCLUDE header.html -->
</div>

<div id='content'>
	<div id='left' style="height:400px;">
    	<!-- INCLUDE photo_list_left.html -->
    </div>
    <div id='maindiv'>
    	<div class="description">
			{page_description} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ORDER_BY}
			<span>
				<select onchange="change_order()" id="order_by">
					<option value="update_time" <!-- IF order_by="update_time" -->selected="selected"<!-- ENDIF -->>{UPDATE_TIME}</option>
					<option value="photo_id" <!-- IF order_by="photo_id" -->selected="selected"<!-- ENDIF -->>{UPLOAD_TIME}</option>
					<option value="downloaded" <!-- IF order_by="downloaded" -->selected="selected"<!-- ENDIF -->>{DOWNLOADED}</option>
				</select>
				<select onchange="change_order()" id="order_asc">
					<option value="ASC" <!-- IF order_asc="ASC" -->selected="selected"<!-- ENDIF -->>{ASC}</option>
					<option value="DESC" <!-- IF order_asc="DESC" -->selected="selected"<!-- ENDIF -->>{DESC}</option>
				</select>
			</span>
        </div>
        
        <div class="real_content">
        <!-- IF page_content -->
        	<!-- 显示特定页面数据 -->
        	{page_content}
        <!-- ELSE -->
        	<!-- IF image_list -->
        	<div class="toolbar">
       	 		<button onclick="edit_images()">{EDIT}</button>&nbsp;
       	 		<button onclick="delete_images()">{DELETE}</button>&nbsp;
       		    <button onclick="check_all();">{CHECK_ALL}</button>&nbsp;
            	<button onclick="inverse();">{CHECK_ANTI}</button>&nbsp;
            	<button onclick="add_to_album();">{ADD_TO_ALBUM}</button>

               	<br />
                {pager}
            </div>
        	<!-- INCLUDE photo_images.html -->
        	<div class="toolbar">
            	{pager}
                <br />
       	 		<button onclick="edit_images()">{EDIT}</button>&nbsp;
       	 		<button onclick="delete_images()">{DELETE}</button>&nbsp;
       		    <button onclick="check_all();">{CHECK_ALL}</button>&nbsp;
            	<button onclick="inverse();">{CHECK_ANTI}</button> 
            </div>
            <!-- ELSE -->
            <div class="notice_button">
            	{NO_PUBLISHED}
            </div>
            <!-- ENDIF -->
        <!-- ENDIF -->
        </div>
        
    </div>
</div>
<script>
function edit_images()
{
	var ids = get_checked();
	if (ids == '')
	{
		alert('{NO_CHECKED_IMAGES}');
		return;
	}
	window.location = "admin.php?p=photo_edit&ids="+ids;
}

function delete_images(ids)
{
	if (!ids) ids = get_checked();
	if (ids == '')
	{
		alert('{NO_CHECKED_IMAGES}');
		return;
	}
	if (!confirm('{DELETE_COMFIRM}')) return;
	$.post("admin.php?p=ajax&m=delete&table=photo&ids="+ids,{ },function(ids)
	{
		var arr = ids.split(',');
		for(i=0;i<arr.length;i++)
		{
			$('#img_img_'+arr[i]).parents('.float_item').fadeOut('fast',function()
			{
				this.parentNode.removeChild(this);
			});
		}
	});
}
load('view/admin/js/photo.js');

function change_order()
{
	var url = window.location.href.toString();
	url = url.replace(/&order_by=[^&]+/,'').replace(/&order_asc=[^&]+/,'');
	window.location.href = url+
	'&order_by='+$('#order_by').val()+'&order_asc='+$('#order_asc').val();
}

function add_to_album(ids)
{
	if (!ids) ids = get_checked();
	if (ids == '')
	{
		alert('{NO_CHECKED_IMAGES}');
		return;
	}
	popup({ url:'admin.php?p=photo_album&action=add',width:300,height:230});
}
</script>
<!-- INCLUDE footer.html -->

</div>
</body>
</html>
